<template>
  <div class="tab" v-loading="load">
    <SupplierInfo ref="supplierInfo" @getAllData="getAllData"></SupplierInfo>
    <ContactTab ref="contactTab" @getAllData="getAllData"></ContactTab>
  </div>
</template>

<script lang="ts" setup>
  import SupplierInfo from './supplierInfo/index.vue'
  import ContactTab from './contactTab/index.vue'
  import { ref, onMounted } from 'vue'
  import { useTagsViewStore } from '@/store/modules/tagsView'
  const load = ref(false)
  const supplierInfo = ref()
  const contactTab = ref()
  const getAllData = async () => {
    try {
      load.value = true
      await supplierInfo.value.getData()
      await contactTab.value.getData()
    } finally {
      load.value = false
    }
  }
  const TagsViewStore = useTagsViewStore()
  //初始化
  onMounted(async () => {
    TagsViewStore.setHistory(history.state)
  })
</script>

<style lang="scss" scoped>
  .tab {
    width: 96%;
    margin: 20px 2% 20px 2%;
    :deep(.el-tabs__content) {
      background-color: #f0f2f5;
      padding: 0;
    }
  }
</style>
